<template>
	<view class="content">
		<view class="header">
			<p class="title">转入质押</p>
			<view class="FIL">
				<view class="FIL_left">
					<p class="text_1">账户余额</p>
					<p>{{wallet.thaw_num}}</p>
				</view>
				<view class="FIL_middle">
					<image src="../../static/zh.png" mode=""></image>
				</view>
				<view class="FIL_right">
					<p class="text_2">账户余额</p>
					<p>{{wallet.thaw_num}}</p>
				</view>
			</view>
		</view>
		<view class="core">
			<view class="core_inform">
				<view class="balance">
					<span>转入数量</span>
					<input type="text" placeholder="请输入转入数量" class="inp" v-model="num">
					<button type="default" @click="confirm" class="confirm">确认转入</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '质押',
				id:"",
				num:"",
				wallet:[]
			}
		},
		onLoad(e) {
			this.id=e.id
		},
		onShow() {
			this.initData()
			this.getdata()
		},
		methods: {
			//获取Token
			initData(){
				if(this.$db.get('userToken')){
					console.log(this.$db.get('userToken'))
				}else{
					this.$db.userToken()
				}
			},
			confirm(){
				let data={
					num:this.num,
					coin_type_id:this.id
				}
				this.$api.pledge(data).then(res=>{
					console.log(res)
					this.$common.successToShow(res.data.msg,()=>{
						
					})
				})
			},
			getdata(){
				let data={
					coin_type_ids:''
				}
				this.$api.wallet(data).then(res=>{
					console.log(res)
					this.wallet=res.data.data[0]
					this.id=res.data.data[0].coin_type_id
				}, err => {})
			}
		}
	}
</script>

<style lang="less">
	*{
		margin: 0;
		padding: 0;
		// background: #f3f3f3;
		font-family: PingFang SC;
	}
	.content{
		width: 100%;
		height: 1334rpx;
		.header{
			height: 414rpx;
			background: #764CFA;
			opacity: 1;
			text-align: center;
			padding: 0 20rpx;
			.title{
				line-height:200rpx;
				color: #FFFFFC;
				font-size: 36rpx;
				background: #764CFA;
				font-family: PingFang SC;
				font-weight: 400;
			}
			.FIL{
				height: 224rpx;
				background: #FFFFFC;
				opacity: 1;
				border-radius: 8px;
				display: flex;
				justify-content: center;
				padding: 20rpx 24rpx;
				margin-top: 40rpx;
				.FIL_left{
					width: 40%;
					// height: 188rpx;
					background: #FFFFFC;
					font-size: 28rpx;
					color: #000000;
					p{
						margin-bottom: 24rpx;
						background: #FFFFFC;
					}
					.text_1{
						margin-top: 40rpx;
					}
				}
				.FIL_middle{
					width: 20%;
					background: #FFFFFC;
					image{
						background: #FFFFFC;
						width: 98rpx;
						height: 98rpx;
					}
				}
				.FIL_right{
					background: #FFFFFC;
					width: 40%;
					// height: 188rpx;
					font-size: 28rpx;
					color: #000000;
					margin-left: 30rpx;
					p{
						margin-bottom: 24rpx;
						background: #FFFFFC;
					}
					.text_2{
						margin-top: 40rpx;
					}
				}
			}
		}
		.core{
			padding:0 20rpx;
			margin-top: 100rpx;
			.core_inform{
				width: 710rpx;
				height: 450rpx;
				background: #FFFFFC;
				opacity: 1;
				border-radius: 8px;
				padding: 40rpx 0;
				.balance{
					background: #FFFFFC;
					padding: 0 40rpx;
					span{
						background: #FFFFFC;
						font-size: 28rpx;
						color: #000000;
					}
					.inp{
						margin-top: 50rpx;
						background: #FFFFFC;
						font-size: 24rpx;
						width: 100%;
						height: 40rpx;
						line-height: 40rpx;
						border-bottom: 1px solid #F2F1F5;
					}
					.confirm{
						margin-top: 80rpx;
						width: 100%;
						height: 98rpx;
						background: #764CFA;
						opacity: 1;
						border-radius: 4px;
						color: #FFFFFF;
						font-size: 28rpx;
						line-height: 98rpx;
					}
				}
			}
		}
	}
</style>
